IsCompound = [bool]

Property

Determines if the data type represents a compound value, such as a String or Complex number.

Product: 

Class: 

Warning

uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments.The next phase envolves some structural changes, performance optimizations, and API refinements.The API is subject to breaking changes prior to the stable release. Please evaluate the preview version thoroughly before production use.

Remarks

The IsCompound property helps distinguish between simple, fundamental data types and more complex, composite ones.

A compound data type is one that is not a simple, primitive numeric or boolean value. In uCalc, this currently includes String and Complex types. This is useful for logic that needs to handle strings and numbers differently without checking for every possible numeric type individually.

Type Categories

✅ Returns true for Compound Types

  • String: A sequence of characters.
  • Complex: A number consisting of a real and an imaginary part.

❌ Returns false for Simple Types

  • Boolean
  • Byte (Int8)
  • Int16, Int32, Int64
  • Single, Double

Comparative Analysis

Without uCalc, determining if a type is "compound" in a host language like C# can be ambiguous. A developer might check if a Type object IsPrimitive or IsValueType, but these concepts don't map directly to uCalc's domain. For example, a C# string is a class (a reference type), not a primitive, while a System.Numerics.Complex is a struct (a value type).

uCalc's IsCompound provides a consistent and straightforward way to classify types based on their role within the expression engine, simplifying the logic for the end-user.

For example, to categorize results:

using uCalcSoftware;

var uc = new uCalc();

var dt = uc.DataTypeOf(expression);
if (dt.IsCompound()) {
   // Handle string or complex result
} else {
   // Handle numeric or boolean result
}

Examples

Determining if a data type is compound or not with IsCompound

ID: 87

				
					using uCalcSoftware;

var uc = new uCalc();
Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound);
Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound);
Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound);
Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound);
Console.WriteLine(uc.DataTypeOf("Bool").IsCompound);
				
			
False
True
True
True
False
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

#define tf(IsTrue) ((IsTrue) ? "True" : "False")

int main() {
   uCalc uc;
   cout << tf(uc.DataTypeOf("2 * (3 + 4)").IsCompound()) << endl;
   cout << tf(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound()) << endl;
   cout << tf(uc.DataTypeOf("3 + 4 * #i").IsCompound()) << endl;
   cout << tf(uc.DataTypeOf(BuiltInType::String).IsCompound()) << endl;
   cout << tf(uc.DataTypeOf("Bool").IsCompound()) << endl;
}
				
			
False
True
True
True
False
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound)
      Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound)
      Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound)
      Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound)
      Console.WriteLine(uc.DataTypeOf("Bool").IsCompound)
   End Sub
End Module
				
			
False
True
True
True
False

This page last modified on: 

8/21/2026